﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Genius.Brain.Shared;
using Genius.Brain.Shared.Strategy;
using Modules.VocabularyTrainer.Impl.BO;
using Modules.VocabularyTrainer.Impl.Strategy;
using Modules.VocabularyTrainer.Shared.BO;
using Modules.VocabularyTrainer.Shared.Strategy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Modules.VocabularyTrainer.Impl.Locator
{
    public class Installer : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            //kein Singleton, wegen Named
            container.Register(Component.For<IGeniusModule>().ImplementedBy<GeniusModule>().Named("VocabularyTrainer").LifestyleTransient());
            //kein Singleton, wegen Constructor(String)
            container.Register(Component.For<ITranslatorStrategy>().ImplementedBy<TranslatorStrategy>().LifestyleTransient());
            container.Register(Component.For<IVocabularyMatchRateStrategy>().ImplementedBy<VocabularyMatchRateStrategy>().LifestyleTransient());

            //JSo's databases converter strategies
            container.Register(Component.For<IJsonConverterStrategy<IDictionaryDatabaseRecord>>().ImplementedBy<DictionaryDatabaseRecordJsonConverterStrategy>().LifestyleSingleton());

            //Business Objects
            container.Register(Component.For<IDictionaryDatabaseRecord>().ImplementedBy<DictionaryDatabaseRecord>().LifestyleTransient());

        }
    }
}
